#pragma once
#include <cv.h>
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>

#include "SupportiveFunctions.h"
#include "MathUtil.h"

class CallibrationData
{
public:
	CallibrationData(void);
	~CallibrationData(void);
	static char* FileName;
	void Serialize();
	static CallibrationData * Deserialize();
	void Copy(CallibrationData * calibData);

	inline CvPoint GetCenterMarkerPoint() { return centerMarkerPoint; };
	inline void SetCenterMarkerPoint(int x, int y) { centerMarkerPoint.x = x; centerMarkerPoint.y = y; };
	inline CvPoint GetLeftMarkerPoint() { return leftMarkerPoint; };
	inline void SetLeftMarkerPoint(int x, int y) { leftMarkerPoint.x = x; leftMarkerPoint.y = y; };
	inline CvPoint GetRightMarkerPoint() { return rightMarkerPoint; };
	inline void SetRightMarkerPoint(int x, int y) { rightMarkerPoint.x = x; rightMarkerPoint.y = y; };
	inline CvPoint GetStethMarkerPoint() { return stethMarkerPoint; };
	inline void SetStethMarkerPoint(int x, int y) { stethMarkerPoint.x = x; stethMarkerPoint.y = y; };

	inline CvPoint GetJugularNotchPoint() { return jugularNotchPoint; };
	inline void SetJugularNotchPoint(int x, int y) { jugularNotchPoint.x = x; jugularNotchPoint.y = y; };
	inline CvPoint GetXiphoidProcessPoint() { return xiphoidProcessPoint; };
	inline void SetXiphoidProcessPoint(int x, int y) { xiphoidProcessPoint.x = x; xiphoidProcessPoint.y = y; };
	inline CvPoint GetLeftCostalMarginPoint() { return leftCostalMarginPoint; };
	inline void SetLeftCostalMarginPoint(int x, int y) { leftCostalMarginPoint.x = x; leftCostalMarginPoint.y = y; };
	inline CvPoint GetRightCostalMarginPoint() { return rightCostalMarginPoint; };
	inline void SetRightCostalMarginPoint(int x, int y) { rightCostalMarginPoint.x = x; rightCostalMarginPoint.y = y; };

	static CallibrationData* ReadAndSaveCallibrationData(IplImage* imageSentForCallibration, BYTE* callibrationInfo);
	float * GetJugularNotchRelativeDistance();
	float * GetXiphoidProcessRelativeDistance();
	float * GetLeftCostalMarginRelativeDistance();
	float * GetRightCostalRelativeDistance();

private:
	CvPoint centerMarkerPoint;
	CvPoint leftMarkerPoint;
	CvPoint rightMarkerPoint;
	CvPoint stethMarkerPoint;

	CvPoint jugularNotchPoint;
	CvPoint xiphoidProcessPoint;
	CvPoint leftCostalMarginPoint;
	CvPoint rightCostalMarginPoint;
};
